package lucava.metamodel.java;

import java.util.ArrayList;
import java.util.List;
import lucava.metamodel.java.type.MetaType;
import lucava.metamodel.java.type.MetaVoid;
import lucava.metamodel.java.visitor.IJavaMetaModelVisitor;

public class MethodeSignature implements IModifiableEntity, IVisibleEntity,
		ICommentableEntity, IAnnotableEntity {

	protected String mName;

	protected MetaType mReturnType = new MetaVoid();

	protected final Visibility mVisibility = new Visibility();

	protected final Modifier mModifier = new Modifier();

	protected final List<Parameter> mParams = new ArrayList<Parameter>();

	protected Methode mMethod;

	public MethodeSignature() {
		this("NewMethode");
	}

	public MethodeSignature(String aName) {
		this.mName = aName;
	}

	public void accept(IJavaMetaModelVisitor aVisitor) {
		aVisitor.visitSignature(this);
	}

	public void addParam(Parameter aParam) {
		this.mParams.add(aParam);
	}

	public void removeParam(Parameter aParam) {
		this.mParams.remove(aParam);
	}

	public Modifier getModifier() {
		return mModifier;
	}

	public void setPrivate() {
		this.mVisibility.setPrivate();
	}

	public void setProtected() {
		this.mVisibility.setProtected();
	}

	public void setPublic() {
		this.mVisibility.setPublic();
	}

	public boolean isAbstract() {
		return this.mModifier.isAbstract();
	}

	public void setAbstract(boolean mIsAbstract) {
		this.mModifier.setAbstract(mIsAbstract);
	}

	public boolean isFinal() {
		return this.mModifier.isFinal();
	}

	public void setFinal(boolean mIsFinal) {
		this.mModifier.setFinal(mIsFinal);
	}

	public boolean isStatic() {
		return this.mModifier.isStatic();
	}

	public void setStatic(boolean mIsStatic) {
		this.mModifier.setStatic(mIsStatic);
	}

	public Visibility getVisibility() {
		return mVisibility;
	}

	public boolean isPrivate() {
		return this.mVisibility.isPrivate();
	}

	public boolean isProtected() {
		return this.mVisibility.isProtected();
	}

	public boolean isPublic() {
		return this.mVisibility.isPublic();
	}

	public MetaType getReturnType() {
		return mReturnType;
	}

	public void setReturnType(MetaType mReturnType) {
		this.mReturnType = mReturnType;
	}

	public String getName() {
		return mName;
	}

	public void setName(String mName) {
		this.mName = mName;
	}

	public List<Parameter> getParams() {
		return mParams;
	}

	public Methode getMethod() {
		return mMethod;
	}

	public void setMethod(Methode mMethod) {
		this.mMethod = mMethod;
	}

	@Override
	public Comments getComments() {
		return this.mMethod.getComments();
	}

	@Override
	public Annotations getAnnotations() {
		return this.mMethod.getAnnotations();
	}

	@Override
	public boolean hasComment() {
		return this.mMethod.hasComment();
	}

	@Override
	public void addComment(String aComment) {
		this.mMethod.addComment(aComment);
	}

	@Override
	public void setComment(String aComment) {
		this.mMethod.setComment(aComment);
	}

	@Override
	public void addAnnotation(String anAnnotation) {
		this.mMethod.addAnnotation(anAnnotation);
	}

	@Override
	public void removeAnnotation(String anAnnotation) {
		this.mMethod.removeAnnotation(anAnnotation);
	}

}
